﻿@using Himall.Model;
@{
    List<ShopBonusReceiveInfo> bonus = ViewBag.ShopBonus as List<ShopBonusReceiveInfo>;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="~/Areas/Mobile/Templates/Default/Scripts/coupon.js"></script>
</head>
<body>
    @model IEnumerable<Himall.Model.UserCouponInfo>
    <div class="container">
        <div class="coupon-list">
            <div class="coupon-hd"><span class="active" id="spanEnable">可用优惠券（@ViewBag.NoUseCount）</span><span id="spanDisable">不可用优惠券（@ViewBag.UserCount）</span></div>
            <div class="coupon-bd">
                @foreach (var coupon in Model)
                {
                    if (coupon.UseStatus == Himall.Model.CouponRecordInfo.CounponStatuses.Used || coupon.EndTime < DateTime.Now)
                    {
                        <ul name="disabled" style="display:none;">
                            <li class ="disabled">
                                <div class="cou-card">
                                    <div>
                                        @if (coupon.VShop == null)
                                        {
                                            <a><img src="http://fpoimg.com/60x30" /></a>
                                        }
                                        else
                                        {
                                            <a><img src="@coupon.VShop.Logo" /></a>
                                        }
                                        </div>
                                        <p>￥@coupon.Price.ToString()</p>
                                    </div>
                                <div class="cou-text clearfix">
									<div class="cou-price">
										<p>满 @coupon.OrderAmount.ToString() 元使用</p>
										<h6>有效期至@(coupon.EndTime.ToString("yyyy-MM-dd"))</h6>
									</div>
                                    <a>@(coupon.UseStatus == Himall.Model.CouponRecordInfo.CounponStatuses.Used ? "已使用" : "已过期") <i class="glyphicon glyphicon-menu-right cirle-right"></i></a>
                                </div>
                                </li>
                        </ul>
                    }
                    else
                    {
                        <ul name="enabled" style="display:block;">
                            <li>
                                <div class="cou-card">
                                    <div>
                                        @if (coupon.VShop != null)
                                        {
                                            <a><img src="@coupon.VShop.Logo" /></a>
                                        }
                                        else
                                        {
                                            <a><img src="http://fpoimg.com/60x30" /></a>
                                        }
                                    </div>
                                    <p>￥@coupon.Price.ToString()</p>
                                </div>
                                <div class="cou-text clearfix">
                                    <div class="cou-price">
                                        <p>满 @coupon.OrderAmount.ToString() 元使用</p>
                                        <h6>有效期至@(coupon.EndTime.ToString("yyyy-MM-dd"))</h6>
                                    </div>
                                    @if (coupon.VShop != null)
                                    {
                                        <a href="/@ViewBag.AreaName/vshop/detail/@coupon.VShop.Id">立即使用
                                            <i class="glyphicon glyphicon-menu-right cirle-right"></i>
                                         </a>
                                        
                                    }
                                    else
                                    {
                                        <a>立即使用 <i class="glyphicon glyphicon-menu-right cirle-right"></i></a>
                                    }
                                </div>
                            </li>
                        </ul>
                    }
                }


                @foreach( var coupon in bonus )
                {
                    if( coupon.State == ShopBonusReceiveInfo.ReceiveState.Use || coupon.Himall_ShopBonusGrant.Himall_ShopBonus.DateEnd < DateTime.Now )
                    {
                        <ul name="disabled" style="display:none;">
                            <li class="disabled">
                                <div class="cou-card">
                                    <div>
                                        @if( coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop != null && coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop.Count() >0 )
                                        {
                                            <a><img src="@coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop.FirstOrDefault().Logo" /></a>
                                        }
                                        else
                                        {
                                            <a><img src="http://fpoimg.com/60x30" /></a>
                                        }
                                    </div>
                                    <p>￥@coupon.Price.ToString()</p>
                                </div>
                                <div class="cou-text clearfix">
                                    <div class="cou-price">
                                        @if( @coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UseState == ShopBonusInfo.UseStateType.FilledSend )
                                        {
                                            if( coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UsrStatePrice == 0 )
                                            {
                                                <p>满 0 元使用</p>
                                            }
                                            else
                                            { 
                                                <p>满 @coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UsrStatePrice 元使用</p>
                                            }
                                        }
                                        else
                                        { 
                                            <p>满 0 元使用</p>
                                        }
                                        <h6>有效期至@(coupon.Himall_ShopBonusGrant.Himall_ShopBonus.BonusDateEnd.ToString( "yyyy-MM-dd" ))</h6>
                                    </div>
                                    <a>@(coupon.State == ShopBonusReceiveInfo.ReceiveState.Use ? "已使用" : "已过期") <i class="glyphicon glyphicon-menu-right cirle-right"></i></a>
                                </div>
                            </li>
                        </ul>
                    }
                    else
                    {
                        <ul name="enabled" style="display:block;">
                            <li>
                                <div class="cou-card">
                                    <div>
                                        <a><img src="@coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Logo " /></a>
                                    </div>
                                    <p>￥@coupon.Price.ToString()</p>
                                </div>
                                <div class="cou-text clearfix">
                                    <div class="cou-price">
                                        @if( @coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UseState == ShopBonusInfo.UseStateType.FilledSend )
                                        {
                                            if( coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UsrStatePrice == 0 )
                                            {
                                                <p>满 0 元使用</p>
                                            }
                                            else
                                            { 
                                                <p>满 @coupon.Himall_ShopBonusGrant.Himall_ShopBonus.UsrStatePrice 元使用</p>
                                            }
                                        }
                                        else
                                        {
                                            <p>满 0 元使用</p>
                                        }
                                        <h6>有效期至@(coupon.Himall_ShopBonusGrant.Himall_ShopBonus.BonusDateEnd.ToString( "yyyy-MM-dd" ))</h6>
                                    </div>
                                    @if( coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop != null && coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop.Count() >0 )
                                    {
                                        <a href="/@ViewBag.AreaName/vshop/detail/@coupon.Himall_ShopBonusGrant.Himall_ShopBonus.Himall_Shops.Himall_VShop.FirstOrDefault().Id">
                                            立即使用
                                            <i class="glyphicon glyphicon-menu-right cirle-right"></i>
                                        </a>
                                    }
                                    else
                                    {
                                        <a>立即使用 <i class="glyphicon glyphicon-menu-right cirle-right"></i></a>
                                    }
                                </div>
                            </li>
                        </ul>
                    }
                }
            </div>
        </div>
    </div>
</body>
</html>
